package com.jd.mysql.mgr.pojo;

import java.io.Serializable;
import java.util.Date;

import com.jd.mysql.mgr.dto.MgrDbErrorDTO;
import com.jd.mysql.mgr.util.DateUtil;
import com.jd.mysql.mgr.util.GlobalStaticVariables;
import com.jd.mysql.mgr.util.StringUtil;

public class MgrDbError implements Serializable {
	private Integer id;
	private String ip;
	private String mcode;
	private String hostname;
	private String dbname;
	private Date faultdate;
	private String applyperson;
	private Integer needcheck;
	private String emergencyplan;
	private String phenomenon;
	private String analysis;
	private String disposalmethod;
	private Integer dbtype;
	@Override
	public boolean equals(Object obj) {
		// TODO Auto-generated method stub
		return super.equals(obj);
	}
	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return super.hashCode();
	}

	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getIp() {
		return ip;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
	public String getMcode() {
		return mcode;
	}
	public void setMcode(String mcode) {
		this.mcode = mcode;
	}
	public String getHostname() {
		return hostname;
	}
	public void setHostname(String hostname) {
		this.hostname = hostname;
	}
	public String getDbname() {
		return dbname;
	}
	public void setDbname(String dbname) {
		this.dbname = dbname;
	}
	public Date getFaultdate() {
		return faultdate;
	}
	public void setFaultdate(Date faultdate) {
		this.faultdate = faultdate;
	}
	public String getApplyperson() {
		return applyperson;
	}
	public void setApplyperson(String applyperson) {
		this.applyperson = applyperson;
	}
	public Integer getNeedcheck() {
		return needcheck;
	}
	public void setNeedcheck(Integer needcheck) {
		this.needcheck = needcheck;
	}
	public String getEmergencyplan() {
		return emergencyplan;
	}
	public void setEmergencyplan(String emergencyplan) {
		this.emergencyplan = emergencyplan;
	}
	public String getPhenomenon() {
		return phenomenon;
	}
	public void setPhenomenon(String phenomenon) {
		this.phenomenon = phenomenon;
	}
	public String getAnalysis() {
		return analysis;
	}
	public void setAnalysis(String analysis) {
		this.analysis = analysis;
	}
	public String getDisposalmethod() {
		return disposalmethod;
	}
	public void setDisposalmethod(String disposalmethod) {
		this.disposalmethod = disposalmethod;
	}
	public Integer getDbtype() {
		return dbtype;
	}
	public void setDbtype(Integer dbtype) {
		this.dbtype = dbtype;
	}
	
	public MgrDbErrorDTO toDTO(){
		MgrDbErrorDTO dto = new MgrDbErrorDTO();
		dto.setShortanalysis(StringUtil.getShort(analysis, GlobalStaticVariables.shortLimit));
		dto.setShortdisposalmethod(StringUtil.getShort(disposalmethod, GlobalStaticVariables.shortLimit));
		dto.setShortemergencyplan(StringUtil.getShort(emergencyplan, GlobalStaticVariables.shortLimit));
		dto.setShortphenomenon(StringUtil.getShort(phenomenon, GlobalStaticVariables.shortLimit));
		dto.setAnalysis(analysis);
		dto.setDisposalmethod(disposalmethod);
		dto.setEmergencyplan(emergencyplan);
		dto.setPhenomenon(phenomenon);
		dto.setApplyperson(applyperson);
		dto.setDbname(dbname);
		dto.setFaultdate(DateUtil.getFormatedDate(faultdate, "yyyy-MM-dd"));
		dto.setHostname(hostname);
		dto.setId(id);
		dto.setNeedcheck(needcheck);
		dto.setMcode(mcode);
		dto.setIp(ip);
		dto.setDbtype(dbtype);
		return dto;
	}
	
}
